package com.springboot.study.consumer;

import com.springboot.study.config.DirectConfig;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class DirectConsumer {

    @RabbitListener(queues = DirectConfig.ERROR_QUEUE)
    public void receiveError(String message) {
        System.out.println("错误日志处理器收到：" + message);
        // 可以在这里发送邮件通知管理员
    }

    @RabbitListener(queues = DirectConfig.INFO_QUEUE)
    public void receiveInfo(String message) {
        System.out.println("信息日志处理器收到：" + message);
        // 记录到日志文件
    }

    @RabbitListener(queues = DirectConfig.WARNING_QUEUE)
    public void receiveWarning(String message) {
        System.out.println("警告日志处理器收到：" + message);
        // 记录到监控系统
    }
}
